from sqlalchemy import Column
from sqlalchemy.types import *
from sqlalchemy.ext.declarative import declarative_base

BaseModel = declarative_base()
class User(BaseModel):
    __tablename__ = 'user1'  # 表名
    user_name = Column(CHAR(30), primary_key=True)
    pwd = Column(VARCHAR(20), default='123456', nullable=False)
    age = Column(SMALLINT(), server_default='12')
    accout = Column(INT())
    birthday = Column(TIMESTAMP())
    article = Column(TEXT())
    height = Column(FLOAT())



from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker



def init_db(engine):
    '''
    初始化数据库
    :return:
    '''
    BaseModel.metadata.create_all(engine)

def drop_all_db(engine):
    '''
    删除所有数据表
    :return:
    '''
    BaseModel.metadata.drop_all(engine)



    # drop_db()
# init_db()